package com.emm.yixun.website.listeners;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.task.Task;

public class OtherFlowSubscribeListeners implements Serializable, ExecutionListener {
	private static final long serialVersionUID = -5279285815885287918L;

	@Override
	public void notify(DelegateExecution execution) throws Exception {
		Task task = execution.getEngineServices().getTaskService().createTaskQuery()
				.processInstanceId(execution.getProcessInstanceId()).active().singleResult();
		Map<String, Object> variables = new HashMap<String, Object>();
		variables.put("flowVariable", 1);
		System.err.println("task:" + task.getId());
		execution.getEngineServices().getTaskService().complete(task.getId(), variables);

	}

}
